package com.tarena.lbs.basic.web.controller;


import com.tarena.lbs.base.protocol.model.Result;
import com.tarena.lbs.base.protocol.pager.PageResult;
import com.tarena.lbs.basic.web.service.BussinessService;
import com.tarena.lbs.pojo.basic.query.BusinessQuery;
import com.tarena.lbs.pojo.basic.vo.BusinessCategoryVO;
import com.tarena.lbs.pojo.basic.vo.BusinessVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
public class BussinessController {


    @Autowired
    private BussinessService bussinessService;


    @GetMapping("/admin/basic/business/info/list")
    public Result<PageResult<BusinessVO>> getPageBusinessVO(BusinessQuery query){
        log.info("query:{}",query);
        PageResult<BusinessVO> resultResult= bussinessService.getPageBusinessVO(query);
        return new Result<>(resultResult);
    }

    @GetMapping("/admin/basic/business/category/list2/")
    public Result<List<BusinessCategoryVO>> getBusinessCategoryVO(){
        log.debug("查询行业分类列表");
        List<BusinessCategoryVO> businessCategoryVOList = bussinessService.getBusinessCategoryVO();
        return new Result<>(businessCategoryVOList);
    }
}
